<%@ page import="cn.dai.pojo.Jojo" %>
<%@ page import="cn.dai.service.model.Page" %>
<%@ page import="cn.dai.service.JojoServiceImpl" %>
<%@ page import="cn.dai.service.JojoService" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/6/4
  Time: 8:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>翻页实现</title>
</head>
<body>

<%
    String pageIndex = request.getParameter("pageIndex");

    if (pageIndex == null) pageIndex = "1";
    Integer index = Integer.valueOf(pageIndex);

    JojoService jojoService = new JojoServiceImpl();
    Page<Jojo> jojoPage = jojoService.getLimitJojoList(index);
%>


<table width="50%" border="1" style="text-align: center">

    <tr>
        <td> 角色ID </td>
        <td> 人物名称 </td>
        <td> 替身名称 </td>
        <td> 首次出现的剧集 </td>
    </tr>

<%
    for (Jojo jojo : jojoPage.getCurrentList()){
%>
    <tr>
        <td> <%= jojo.getJo_id()%> </td>
        <td> <%= jojo.getJo_name()%> </td>
        <td> <%= jojo.getJo_standard()%> </td>
        <td> <%= jojo.getJo_season()%> </td>
    </tr>
<%
    }
%>

</table>

<p>
    <strong>
        <a href="paging.jsp">[首页]</a>

        <a href="paging.jsp?pageIndex=<%= jojoPage.getPageIndex() - 1 %>">[上一页]</a>

        【本页位置：<%= jojoPage.getPageIndex() %>】

        <a href="paging.jsp?pageIndex=<%= jojoPage.getPageIndex() + 1 %>"> [下一页]</a>

        <a href="paging.jsp?pageIndex=<%= jojoPage.getTotalPages() %>">[末页]</a>

        【一共<%= jojoPage.getTotalPages()%>页，<%= jojoPage.getTotals()%>条记录】
    </strong>

    <form action="paging.jsp" method="get">
        到第 <input type="text" name="pageIndex"> 页
        <input type="submit" value="确定">
    </form>
</p>

</body>
</html>
